package org.example;

import java.util.*;

class Solution {
    public boolean isIsomorphic(String s, String t) {
        Map<Character, Character> map = new HashMap<>();
        Set<Character> mappedChars = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            char cs = s.charAt(i);
            char ct = t.charAt(i);
            if (map.containsKey(cs)) {
                if (map.get(cs) != ct) {
                    return false;
                }
                continue;
            }
            if (mappedChars.contains(ct)) {
                return false;
            }
            map.put(cs, ct);
            mappedChars.add(ct);
        }
        return true;
    }
}

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}